/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import entities.Usuario;
import java.util.List;
import javax.ejb.EJB;
import services.IPersonasServiceRemote;

/**
 *
 * @author Juanjo
 */

public class PersonasBean
{
    //-----------------------------------------------------------
    // Atributos
    //-----------------------------------------------------------
    private Usuario user = new Usuario();

    @EJB
    private IPersonasServiceRemote personasService;

    //-----------------------------------------------------------
    // Constructor
    //-----------------------------------------------------------
    /** Creates a new instance of PersonasBean */
    public PersonasBean() 
    {

    }

    //-----------------------------------------------------------
    // Getter/Setters
    //-----------------------------------------------------------

    public List getPersonas()
    {
        return personasService.getPersonas();
    }

    public void editUser()
    {
        personasService.editPersona(user);
    }

    public void eliminarPersona( )
    {
        personasService.eliminarPersona(user);
    }

    public void buscarPersona()
    {
        Usuario u =  personasService.buscarPersona(user);
        user = u;
    }

    /**
     * @return the user
     */
    public Usuario getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(Usuario user) {
        this.user = user;
    }


}
